package com.codi.bus.core.service.model;

import com.alibaba.fastjson.annotation.JSONField;
import com.codi.base.util.MoneyUtils;
import com.codi.bus.constant.GlobalConstant;
import com.codi.bus.core.resultModel.BaseResult;
import lombok.Data;

import java.math.BigDecimal;

/**
 * @author lvgo
 * @version 1.0
 * @Description: 交易确认
 * @date 2018/4/13 16:10
 */
@Data
public class ConfirmResultModel extends BaseResult {


    /**
     * 标题
     */
    private String title;
    /**
     * 手续费标题
     */
    private String expenseTitle;
    /**
     * 金额份额标题
     */
    private String affirmShareTtile;

    /**
     * 手续费
     */
    private BigDecimal expense;
    /**
     * 金额份额
     */
    private BigDecimal affirmShare;
    /**
     * 赎回提示
     */
    private String tip;
    /*
     * 业务代码
     */
    private String fundBusinCode;

    /**
     * 状态  是否有数据 0 没有 1 有
     */
    private Integer state;

    /**
     * 基金类型
     */
    @JSONField(serialize = false)
    private String fundType;

    /**
     * 手续费字符串
     */
    public String getExpenseStr() {
        if (this.expense == null) {
            return "-.--";
        }
        if (this.expense.compareTo(BigDecimal.valueOf(0)) == 0) {
            if (GlobalConstant.FUND_TYPE_CURRENCY_STR.equals(this.fundType)) {
                return "0.00";
            } else {
                return "-.--";
            }
        }
        return MoneyUtils.formatMoney(this.expense, 2);
    }

    /**
     * 金额份额字符串
     */
    public String getAffirmShareStr() {
        if (this.affirmShare == null) {
            return null;
        }
        if (this.affirmShare.compareTo(BigDecimal.valueOf(0)) == 0) {
            return "-.--";
        }
        return MoneyUtils.formatMoney(this.affirmShare, 2);
    }
}
